//
// Created by guanyicheng on 2022/4/6.
//

#include "../../common.h"

class Solution {
public:
    string replaceSpace(string s) {
        int num = 0;
        for (char c: s) {
            if (c == ' ') {
                ++num;
            }
        }
        int oldSize = s.length();
        int newSize = s.length() + num * 2;
        s.resize(newSize);
        for (int i = oldSize - 1, j = newSize - 1; i < j; --i) {
            if (s[i] != ' ') {
                s[j] = s[i];
                --j;
            } else {
                s[j--] = '0';
                s[j--] = '2';
                s[j--] = '%';
            }
        }
        return s;
    }
};

int main() {
    char c1 = '/0';
    char c[] = {'a', 's', 'd', c1};
    cout << c1 << endl;
    cout << c[3] << endl;
    cout << (c[3] == c1) << endl;

}